<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        var a = {
            x: 10,
            y: 20,
            k: {
                c: 30,
                d: {
                    e: 40
                }
            }
        }

        console.log( JSON.stringify(a) );
        var b = JSON.parse( JSON.stringify(a) );

        b.z = 60;
        b.k.o = 70;
        console.log(b);
        console.log(a);
    </script>
</body>
</html>